{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d240914c",
   "metadata": {},
   "source": [
    "## Checking if true or false"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dcf86730",
   "metadata": {},
   "source": [
    "- true is written as True\n",
    "- false is written as False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a5169d7f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "do this\n"
     ]
    }
   ],
   "source": [
    "a=True\n",
    "if a==True:\n",
    "    print('do this')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bfe24775",
   "metadata": {},
   "source": [
    "### Checking if true:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "af8a9491",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "do this\n"
     ]
    }
   ],
   "source": [
    "# or use this directly:\n",
    "if a:\n",
    "    print('do this')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b1ec0cfd",
   "metadata": {},
   "source": [
    "### Checking if false:"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e01bf132",
   "metadata": {},
   "source": [
    "- False in python=empty values=(),[],{},0,0.0,\"\",None\n",
    "- Note: space is not false,empty is false"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "7efd08d8",
   "metadata": {},
   "outputs": [],
   "source": [
    "if not a:\n",
    "    print('do this')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1708d542",
   "metadata": {},
   "source": [
    "### Note"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b363ab2f",
   "metadata": {},
   "source": [
    "- Comparison operators(<,>,==,!=) returns bools\n",
    "    - 1<2\n",
    "    - 0<=1\n",
    "    - 1==2\n",
    "    - 1!=0"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}